import java.util.Scanner;

public class test6 {
    /*数字加密
    需求:
    1.某系统的数字密码(大于0),比如1983,采用加密方式进行传输
    2.规则如下:先得到每位数,然后每位数都加上5,再对10求余,最后将所有数字反转,得到一串新数
     */
    public static void main(String[] args) {
    //把整数里面的每一位放到数组当中
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入密码位数:");
        int a = sc.nextInt();

        int[] arr = new int[a];
        System.out.println("请输入密码:");
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }
    //加密
        for (int i = 0; i < arr.length; i++) {
            arr[i]+= arr[i]+5;
            arr[i] = arr[i]%10;
        }
        int temp;
        for (int i = 0; i <= arr.length; i++) {
            for (int j = arr.length-1; i<j; j--) {
                temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
            }
        }
    //把数组里面的每一个数字进行拼接,得到加密后的结果
        int number = 0 ;
        for (int i = 0; i < arr.length; i++) {
            number = number*10+arr[i];
        }
        System.out.println("加密后密码为:");
        System.out.println(number);
    }
}
